package com.trainsmart.smartmvc
{
	import flash.events.Event;
	
	import mx.rpc.events.FaultEvent;
	
	public interface IModel
	{
		/**
		 * save vo 
		 * highly recommend to use func(vo'). this vo' would be new vo with Id changed
		 * need to check vo type
		 */ 
		function save(vo:*, func:Function=null, resultHandler:Event=null, faultHandler:FaultEvent=null):void;		
		
		/**
		 * update vo
		 * highly recommend to use func(Boolean)
		 * need to check vo type
		 */ 
		function update(vo:*, func:Function=null, resultHandler:Event=null, faultHandler:FaultEvent=null):void;
		/**
		 * delete vo
		 * highly recommend to use func(Boolean)
		 * need to check vo type
		 */ 
		function remove(vo:*, func:Function=null, resultHandler:Event=null, faultHandler:FaultEvent=null):void;
		/**
		 * find vo by Id
		 * Id type is unique
		 * highly recommend to use func(vo) 
		 */ 
		function findById(Id:*, func:Function=null, resultHandler:Event=null, faultHandler:FaultEvent=null):void;
		/**
		 * find vo by properitis
		 * highly recommend to use args as an object with parameter. for example, args["startTime"]=new Date(); args["valid"]=true
		 * In this method, retrieve parameter like this. var time:Date = args["startTime"] as Date; var valid:Boolean=args["valid"] as Boolean
		 * highly recommand to use func(vos:ArrayCollection) or func(vos:Array)
		 */ 
		function findByProperties(args:Array, func:Function=null, resultHandler:Event=null, faultHandler:FaultEvent=null):void;
		/**
		 * check vo variable type and garante vo's type is VO
		 */ 
		function checkVO(vo:*):void;
	}
}